package com.visionblue.business.ship.model.bean.local

import java.math.BigDecimal

/**
 * @author: xlh
 * @date: 2020-07-20 5:41 PM
 * @desc:
 */
data class VolumeErrorInfo(
    val type: Int,
    val errVal: Float,
    val alias: String?
) {

    companion object {
        const val OIL = 1
        const val WATER = 2
        const val SONIC = 3
        const val WASTE_WATER = 4

        fun makeOilVolumeError(errVal: Float, alias: String?): VolumeErrorInfo {
            return VolumeErrorInfo(OIL, errVal, alias)
        }

        fun makeWaterVolumeError(errVal: Float, alias: String?): VolumeErrorInfo {
            return VolumeErrorInfo(WATER, errVal, alias)
        }

        fun makeWasteWaterVolumeError(errVal: Float, alias: String?): VolumeErrorInfo {
            return VolumeErrorInfo(WASTE_WATER, errVal, alias)
        }

        fun makeSonicVolumeError(errVal: Float, alias: String?): VolumeErrorInfo {
            return VolumeErrorInfo(SONIC, errVal, alias)
        }
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as VolumeErrorInfo

        if (type != other.type) return false

        return true
    }

    override fun hashCode(): Int {
        return type
    }
}
